package kr.hkit.info.powerjava.ch24;

import java.io.*;

class Student
{
	 int stdNum;
	 int Eng;
	 int math;
	 int sic;
	public Student(int stdNum, int eng, int math, int sic) {
		this.stdNum = stdNum;
		Eng = eng;
		this.math = math;
		this.sic = sic;
	}
	@Override
	public String toString() {
		return "Student [stdNum=" + stdNum + ", Eng=" + Eng + ", math=" + math
				+ ", sic=" + sic + "]";
	}
	public int getStdNum() {
		return stdNum;
	}
	public void setStdNum(int stdNum) {
		this.stdNum = stdNum;
	}
	public int getEng() {
		return Eng;
	}
	public void setEng(int eng) {
		Eng = eng;
	}
	public int getMath() {
		return math;
	}
	public void setMath(int math) {
		this.math = math;
	}
	public int getSic() {
		return sic;
	}
	public void setSic(int sic) {
		this.sic = sic;
	} 
}

public class Students {
	 public static void main(String[] args) throws Exception {
		 Student[] stds ={
				 new Student(1,20,10,30),

				 new Student(2,20,10,100),

				 new Student(3,20,10,302)
		 };
		 
		 Input();
		 Ouput();		 
	}

	private static void Ouput() {
		
	}

	private static void Input() throws FileNotFoundException, IOException, Exception {
		ObjectInputStream  in = null;
		ObjectOutputStream out = null;
		
		try{

			
			int c;
			out = new ObjectOutputStream(new FileOutputStream("student.dat"));
			out .writeObject(new Students());
			out.flush();
			
			in  = new ObjectInputStream(new FileInputStream("student.dat" ) );
			Student s = (Student) in.readObject();
			System.out.println(s);
		}
		finally{
			if(in != null) in.close();
			if(out != null) out.close();
		}


		
	}
}
